package com.zmn.oms.services.impl.remark;

import com.zmn.oms.model.entity.remark.OrderRemark;
import com.zmn.oms.persistence.interfaces.remark.OrderRemarkDao;
import com.zmn.oms.services.interfaces.remark.OrderRemarkService;
import io.shardingsphere.api.HintManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 类描述：
 *
 * @author lujia
 * @date 2018/11/28 16:09
 */
@Service
public class OrderRemarkServiceImpl implements OrderRemarkService {

	@Autowired
	private OrderRemarkDao orderRemarkDao;

	@Override
	public OrderRemark findByOrderIdAndType(Long orderId, Long workId, Integer type) {
		return orderRemarkDao.findByOrderIdAndType(orderId, workId, type);
	}

	@Override
	public List<OrderRemark> listOrderRemarkByOrderIdList(List<Long> orderIdList) {
		try (HintManager hintManager = HintManager.getInstance()) {
			hintManager.setMasterRouteOnly();
			return orderRemarkDao.listOrderRemarkByOrderIdList(orderIdList);
		}
	}

	@Override
	public List<OrderRemark> listOrderRemarkByOrderIdListAndType(List<Long> orderIdList, Integer type) {
		return orderRemarkDao.listOrderRemarkByOrderIdListAndType(orderIdList, type);
	}

	@Override
	public void deleteOrderRemarkByParams(OrderRemark orderRemark) {
		orderRemarkDao.deleteOrderRemarkByParams(orderRemark);
	}

	@Override
	public void insertOrderRemark(OrderRemark orderRemark) {
		orderRemarkDao.insertOrderRemark(orderRemark);
	}

}
